package kodkod.analysis;

import kodkod.engine.satlab.SATSolver;

public class SolverThread extends Thread {
	SATSolver cnf;
	public long time = -1;
	public int nofConflicts = 0;
	public boolean isSat = false;
	
	public SolverThread(SATSolver cnf) {
		super(null, null, "name", 1024);
		this.cnf = cnf;
		this.time = -1;
	}
	
	public void run() {
		final long startSolve = System.currentTimeMillis();
		isSat = cnf.solve();
		final long endSolve = System.currentTimeMillis();
//		nofConflicts = ((OrderableSolver)cnf).getNumberOfConflicts();
		cnf.free();
		time = endSolve - startSolve;
	}
	
	public int getNumberOfConflicts() {
		return nofConflicts;
	}
	
	public native void stopSolver();
}
